﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace GetWebsite.GUI.Base
{
    public class CommandBase   : ICommand
    {
        public event EventHandler? CanExecuteChanged;

        public Action<object>? ExecuteAction { get; set; }
        public Func<object, bool>? CanExecuteAction { get; set; }

        public bool CanExecute(object? parameter)
        {
            if (CanExecuteAction != null)
                return CanExecuteAction(parameter);
            return false;
        }

        public void Execute(object? parameter)
        {
            ExecuteAction?.Invoke(parameter);
        }
    }
}
